#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int a = 0, b = 0, c = 0, d = 0;
	scanf("%d%d", a, b);
	if (a > b)
	{
		c = a;
	}
	else {
		c = b;
	}
	for (d = 0; d <= c; d++)
	{
		if (a % d == 0 & b % d == 0)
			printf("%d", d);
	}
	return 0;
}